﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;

namespace Testing_components
{
    /// <summary>
    /// Interaction logic for TableRules.xaml
    /// </summary>
    public partial class TableRules : UserControl
    {
        ObservableCollection<PresentableRule> rules = new ObservableCollection<PresentableRule>();
        public TableRules()
        {
            InitializeComponent();
            ObservableCollection<ConditionOpPair> conditions = new ObservableCollection<ConditionOpPair>();
            conditions.Add(new ConditionOpPair() {SensorName ="T Sensor1", OP = "<", CompareValue =27 });
            conditions.Add(new ConditionOpPair() { SensorName = "T Sensor2", OP = ">=", CompareValue = 18 });
            conditions.Add(new ConditionOpPair() { SensorName = "T Sensor4", OP = "==", CompareValue = 22 });
            conditions.Add(new ConditionOpPair() { SensorName = "T Sensor7", OP = "!=", CompareValue = 30 });

            rules.Add(new PresentableRule() { Name = "Fire alarm on left wall", Description = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", Status = "Active", Conditions = conditions });
            rules.Add(new PresentableRule() { Name = "Control water presure in pump 1", Status = "Active", Conditions = conditions });
            rules.Add(new PresentableRule() { Name = "Airflow control based on weather", Status = "Active", Conditions = conditions });
            rules.Add(new PresentableRule() { Name = "Lights in main room control", Status = "Disabled", Conditions = conditions });
            rules.Add(new PresentableRule() { Name = "Actions in case of flooding", Status = "Active", Conditions = conditions });

            radGridRules.DataContext = rules;
        }
    }
}
